<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>发布稿件- ${site.name} - Powered by JEECMS</title>
<link href="${resSys}/front.css" rel="stylesheet" type="text/css"/>
<link href="${resSys}/jqueryUI/jquery.ui.css" rel="stylesheet" type="text/css"/>
<script src="${resSys}/jquery.js" type="text/javascript"></script>
<script src="${base}/res/common/js/jquery.ext.js" type="text/javascript"></script>
<script src="${resSys}/jqueryUI/jquery-ui.js" type="text/javascript"></script>
<script src="${resSys}/front.js" type="text/javascript"></script>
<script src="${base}/thirdparty/ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="${base}/thirdparty/swfupload/swfupload.js" type="text/javascript"></script>
<script src="${base}/thirdparty/swfupload/swfupload.queue.js" type="text/javascript"></script>
<script src="${base}/thirdparty/swfupload/fileprogress.js" type="text/javascript"></script>
<script src="${base}/thirdparty/swfupload/handlers.js" type="text/javascript"></script>
<link href="${base}/thirdparty/swfupload/process.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="../../${res}/css/member.css" />
<script type="text/javascript">
$.validator.methods.leafChannel = function(value, element, param) {
	var i = element.selectedIndex;
	return $(element.options[i]).attr("class")!="sel-disabled";
}
$(function() {
	$("#jvForm").validate({
		rules: {
			channelId: {
				required: true,
				leafChannel: true
			}
		},
		messages:{
			channelId: {
				leafChannel: "请选择末级栏目"
			}
		}
	});
	var uploadPicsUrl = "o_swfPicsUpload.jspx";
	var uploadAttachsUrl = "o_swfAttachsUpload.jspx";
	//在firefox、chrome下，上传不能保留登录信息，所以必须加上jsessionid。
	var jsessionid = $.cookie("JSESSIONID");
	if(jsessionid) {
		uploadPicsUrl += ";jsessionid="+jsessionid;
		uploadAttachsUrl += ";jsessionid="+jsessionid;
	}
	swfu=new SWFUpload({
		upload_url : uploadPicsUrl,
		flash_url : "${base}/thirdparty/swfupload/swfupload.swf",
		file_size_limit : "20 MB",
		file_types : "*.jpg;*.gif;*.png;*.bmp",
		file_types_description : "图片",
		file_queue_limit : 0,
		custom_settings : {
			progressTarget : "fsUploadProgress",
			cancelButtonId : "btnCancel"
		},
		debug: false,
		
		button_image_url : "${base}/thirdparty/swfupload/button_notext.png",
		button_placeholder_id : "spanButtonPlaceHolder",
		button_text: "<span class='btnText'>上传</span>",
		button_width: 84,
		button_height: 24,
		button_text_top_padding: 2,
		button_text_left_padding: 20,
		button_text_style: '.btnText{color:#666666;}',
		
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadPicsSuccess,
		upload_complete_handler : uploadComplete,
		queue_complete_handler : queueComplete
	});
	swfau=new SWFUpload({
		upload_url : uploadAttachsUrl,
		flash_url : "${base}/thirdparty/swfupload/swfupload.swf",
		file_size_limit : "2000 MB",
		file_types : "*.*",
		file_types_description : "All Types",
		file_queue_limit : 0,
		custom_settings : {
			progressTarget : "afsUploadProgress",
			cancelButtonId : "abtnCancel"
		},
		debug: false,
		
		button_image_url : "${base}/thirdparty/swfupload/button_notext.png",
		button_placeholder_id : "aspanButtonPlaceHolder",
		button_text: "<span class='btnText'>上传</span>",
		button_width: 84,
		button_height: 24,
		button_text_top_padding: 2,
		button_text_left_padding: 20,
		button_text_style: '.btnText{color:#666666;}',
		
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadAttachSuccess,
		upload_complete_handler : uploadComplete,
		queue_complete_handler : queueComplete
	});
});
function uploadPicsSuccess(file,data) {
	var jsonData=eval("("+data+")");//转换为json对象 
	if(jsonData.error!=null){
		$.alert("[@s.m 'global.prompt'/]",jsonData.error);
	}else{
		addPicLine();
		var index = picIndex - 1;
		imgUrl=jsonData.imgUrl;
		$("#preImg"+index).attr("src",""+imgUrl);
		var imgSrc = parent.document.getElementById("preImg"+index);
		if(!$(imgSrc).attr("noResize")) {
			$(imgSrc).css("width","auto");
			$(imgSrc).css("height","auto");
		}
		$("#uploadImgPath"+index).val(imgUrl);
	}
}
function uploadAttachSuccess(file,data) {
	var jsonData=eval("("+data+")");//转换为json对象 
	if(jsonData.error!=null){
		$.alert("[@s.m 'global.prompt'/]",jsonData.error);
	}else{
		addAttachLine();
		var index = attachIndex - 1;
		var attachUrl=jsonData.attachUrl;
		var attachName=jsonData.attachName;
		$("#attachmentPaths"+index).val(attachUrl);
		$("#attachmentNames"+index).val(attachName);
	}
}
</script>
<style type="text/css">
.sel-disabled{background-color:#ccc}
</style>
</head>
<body>
[#include "member_header.html"/]
<div class="container">
	 [#include "member_navi.html"/]
    <div class="mc_right">
        [#include "member_top.html"/]
        <div class="mr-top-position">
		     <div class="mr-top-tit fl">发布稿件</div>
		    <div class="modify fr"><a href="${base}/member/contribute_list.jspx">稿件列表</a></div>
		 </div>
        <div class="mc_content">   
           	[#if channelList?size gt 0]
            [#include "media_upload.html"/]
            [#include "image_upload.html"/]
            [#include "attachment_upload.html"/]
            <form id="jvForm" action="contribute_save.jspx" method="post">
             <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#C8DCF0" style="margin:5px;">
               <tr>
                 <td width="100" height="25" align="right" bgcolor="#f6fbff">标题：</td>
                 <td width="612" bgcolor="#FFFFFF"><input type="text" name="title" maxlength="150" class="required"/> <span class="STYLE1">*</span></td>
               </tr>
               <tr>
                 <td height="25" align="right" bgcolor="#f6fbff">TAGS：</td>
                 <td bgcolor="#FFFFFF">
                 <input type="text" name="tagStr" maxlength="255"/> 用,分割</td>
               </tr>
               <tr>
                 <td height="25" align="right" bgcolor="#f6fbff">作者：</td>
                 <td bgcolor="#FFFFFF"><input type="text" name="author" maxlength="100"/></td>
               </tr>
               <tr>
                 <td height="25" align="right" bgcolor="#f6fbff">栏目：</td>
                 <td bgcolor="#FFFFFF">
                 <select name="channelId">
                    <option value="" class="sel-disabled">--请选择--</option>
                [#if channelList?size gt 0]
                [#assign origDeep=channelList[0].deep+1/]
                [#list channelList as c]
                    <option value="${c.id}"[#if c.child?size gt 0] class="sel-disabled"[/#if]>[#if c.deep gte origDeep][#list origDeep..c.deep as i]&nbsp;&nbsp;[/#list]>[/#if]${c.name}</option>
                [/#list]
                [/#if]
                </select>
                 </td>
               </tr>
               <tr>
                 <td height="25" align="right" bgcolor="#f6fbff">摘要：</td>
                 <td bgcolor="#FFFFFF"><textarea name="description" rows="3" cols="70" maxlength="255"/></textarea></td>
               </tr> 
               <tr>
                 <td  height="25" align="right" bgcolor="#f6fbff">多媒体：</td>
                 <td bgcolor="#FFFFFF">
                 	<div>
						<input type="text" id="mediaPath" name="mediaPath" style="width:265px"/>
					</div>
					<div>
						<span id="mfc" style="position:relative;display:block;width:520px;*width:300px;">
						<input type='text' id='mediaFileText'/>  
						<input class="member_button" type='button' value='浏览'/>
						<input onchange="$('#mediaFileText').val(this.value)" size="19" type="file" name="mediaFile" id="mediaFile" style="height:24px;opacity:0;filter:alpha(opacity=0);position:absolute;left:0px;top:2px;"/>
						<input type="button" value="上传" onclick="uploadMedia();" class="member_button"/>
						</span> 
					</div>
                 </td>
               </tr> 
               <tr>
                 <td height="25" align="right" bgcolor="#f6fbff">播放器：</td>
                 <td bgcolor="#FFFFFF">
						[@p.radio name="mediaType" list=["WM","REAL","FLV","FLASH","CK"] value="CK"/]
                 </td>
               </tr>
               <tr>
                 <td height="25" align="right" bgcolor="#f6fbff">内容：</td>
                 <td bgcolor="#FFFFFF">
				<textarea id="txt" name="txt"></textarea> 
                 <script type="text/javascript">
						$(function() {
						   	CKEDITOR.replace( 'txt' ,
						   			{
								   		filebrowserUploadUrl : '${base}/fck/upload.jspx',  
								   		filebrowserImageUploadUrl : '${base}/fck/upload.jspx?Type=Image',  
								   		filebrowserFlashUploadUrl : '${base}/fck/upload.jspx?Type=Flash',
								   		filebrowserMediaUploadURL : '${base}/fck/upload.jspx?Type=Media'
						   		     }
						   	);  
						 });
				</script>
                 </td>
               </tr> 
              <tr>
                 <td height="25" align="right" bgcolor="#f6fbff">附件：</td>
                 <td bgcolor="#FFFFFF">
                 	<div>
					<span id="aspanButtonPlaceHolder"></span>
					<span style="display: none;"><input class="cancel" id="abtnCancel" type="button" value="取消" onclick="swfu.cancelQueue();" disabled="disabled" /></span>
					<div id="afsUploadProgress" style="display: none;"></div>
					</div>
					<table id="attachTable" border="0">
					<tr>
						<td align="center"></td>
						<td align="center">附件名称</td>
						<td align="center">路径</td>
						<td align="center">上传</td>
					</tr>
					</table>
					<textarea id="attachTr" style="display:none">
					<tr id="attachTr{0}">
						<td align="center"><a onclick="$('#attachTr{0}').remove();" href="javascript:void(0);" class="pn-opt">删除</a></td>
						<td align="center"><input type="text" id="attachmentNames{0}" name="attachmentNames"/></td>
						<td align="center"><input type="text" id="attachmentPaths{0}" name="attachmentPaths"/></td>
						<td align="center">
							<span id="afc{0}" style="position:relative;display:block;width:300px;*width:300px;">
							<input type='text' id='attachmentText{0}'/>  
							<input onchange="$('#attachmentText{0}').val(this.value)" size="19" type="file" name="attachmentFile" id="attachmentFile{0}" style="height:24px;opacity:0;filter:alpha(opacity=0);position:absolute;right:69px;top:2px;"/>
							<input type="button" value="上传" onclick="uploadAttachment({0});" />
							</span>
							<input type="hidden" id="attachmentFilenames{0}" name="attachmentFilenames"/>
						</td>
					</tr>
					</textarea>
					<script type="text/javascript">
					var attachIndex = 1;
					var attachTpl = $.format($("#attachTr").val());
					function addAttachLine() {
						$('#attachTable').append(attachTpl(attachIndex++));
					}
					</script>
                 </td>
               </tr> 
                <tr>
                    <td width="13%" height="30" align="right" bgcolor="#fafafa">图片集：</td>
                    <td bgcolor="#FFFFFF">
	                    <div>
						<span id="spanButtonPlaceHolder"></span>
						<span style="display: none;"><input class="cancel" id="btnCancel" type="button" value="取消" onclick="swfu.cancelQueue();" disabled="disabled" /></span>
						<div id="fsUploadProgress" style="display: none;"></div>
						</div>
						<div id="picBefore" style="clear:both"></div>
						<div id="picTable" style="display:none;">
						<table id="picTable{0}" border="0" style="float:left;">
						<tr>
							<td>
								<div><input type="text" id="uploadImgPath{0}" name="picPaths" style="width:160px"/> <a href="javascript:void(0);" onclick="$('#picTable{0}').remove();" class="pn-opt">删除</a></div>
								<div>
								<span id="ufc{0}" style="position:relative">
								<input type='text' id='uploadFileText{0}' size="10"/>  
								<input onchange="$('#uploadFileText{0}').val(this.value)" size="10" type="file" id="uploadFile{0}"/>
								</span>
								<input type="button" value="上传" onclick="upload({0});" />
								</div>
								<div><textarea style="width:200px;height:60px;" name="picDescs" maxlength="255"></textarea></div>
							</td>
							<td><img id="preImg{0}" alt="预览" noResize="true" style="width:110px;height:110px;background-color:#ccc;border:1px solid #333"/></td>
						</tr>
						</table>
						</div>
						<script type="text/javascript">
						var picIndex = 1;
						var picTpl = $.format($("#picTable").html());
						function addPicLine() {
							$('#picBefore').before(picTpl(picIndex++));
						}
						</script>
                    </td>
               </tr>
               <tr>
                      <td width="13%" height="30" align="right" bgcolor="#fafafa">验证码：</td>
                      <td bgcolor="#FFFFFF">
                     <input type="text" name="captcha" maxlength="20" class="required"/> 
                       </td>
               </tr>
               <tr>
                      <td width="13%" align="right" bgcolor="#fafafa"></td>
                      <td bgcolor="#FFFFFF">
                     <img id="guestbookCaptcha" src="${base}/captcha.svl" onclick="this.src='${base}/captcha.svl?d='+new Date()"/>
                       </td>
               </tr>
               <tr>
                 <td height="25" colspan="2" align="center" bgcolor="#FFFFFF">
                 <input type="hidden" name="nextUrl" value="contribute_list.jspx"/>
                 <input type="submit" value="提交" class="member_button"/> <input type="reset" value="重置" class="member_button"/>
                 </td>
                 </tr>
             </table>
             </form>
            [#else]
            <div>系统不允许投稿，请联系管理员！</div>
            [/#if]
    	</div>
  </div>
     <div style="clear:both"></div>
</div>
</body>
</html>
